package com.briup.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;

public class Environment implements Serializable {
    //序列化版本号
    private static final long serialVersionUID = 1L;
    //采集数据的名称
    private String name;
    //发送端ID
    private String srcId;
    //树莓派系统ID
    private String desId;
    //试验箱区域模块Id(1-8)
    private String devId;
    /*模块上传感器地址
    16---温度、湿度数据  256---光照数据  1280---CO2浓度
     */
    private String sensorAddress;
    //传感器个数
    private int count;
    /*指令标号
    3---接收数据  16---发送数据
     */
    private String cmd;
    //环境数据
    private float data;
    //状态标识
    private int status;
    //采集时间
    private Timestamp gather_date;

    public Environment() {
    }
    public Environment(String name, String srcId, String desId, String devId, String sensorAddress, int count, String cmd, float data, int status, Timestamp gather_date) {
        this.name = name;
        this.srcId = srcId;
        this.desId = desId;
        this.devId = devId;
        this.sensorAddress = sensorAddress;
        this.count = count;
        this.cmd = cmd;
        this.data = data;
        this.status = status;
        this.gather_date = gather_date;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSrcId(String srcId) {
        this.srcId = srcId;
    }

    public void setDesId(String desId) {
        this.desId = desId;
    }

    public void setDevId(String devId) {
        this.devId = devId;
    }

    public void setSensorAddress(String sensorAddress) {
        this.sensorAddress = sensorAddress;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public void setCmd(String cmd) {
        this.cmd = cmd;
    }

    public void setData(float data) {
        this.data = data;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setGather_date(Timestamp gather_date) {
        this.gather_date = gather_date;
    }

    public String getName() {
        return name;
    }
    public String getSrcId() {
        return srcId;
    }
    public String getDesId() {
        return desId;
    }
    public String getDevId() {
        return devId;
    }
    public String getSensorAddress() {
        return sensorAddress;
    }
    public int getCount() {
        return count;
    }
    public String getCmd() {
        return cmd;
    }
    public float getData() {
        return data;
    }
    public int getStatus() {
        return status;
    }
    public Timestamp getGather_date() {
        return gather_date;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Environment that = (Environment) o;
        return count == that.count && Float.compare(data, that.data) == 0 && status == that.status && Objects.equals(name, that.name) && Objects.equals(srcId, that.srcId) && Objects.equals(desId, that.desId) && Objects.equals(devId, that.devId) && Objects.equals(sensorAddress, that.sensorAddress) && Objects.equals(cmd, that.cmd) && Objects.equals(gather_date, that.gather_date);
    }
    @Override
    public int hashCode() {
        return Objects.hash(name, srcId, desId, devId, sensorAddress, count, cmd, data, status, gather_date);
    }
    @Override
    public String toString() {
        return "Environment{" +
                "name='" + name + '\'' +
                ", srcId='" + srcId + '\'' +
                ", desId='" + desId + '\'' +
                ", devId='" + devId + '\'' +
                ", sensorAddress='" + sensorAddress + '\'' +
                ", count=" + count +
                ", cmd='" + cmd + '\'' +
                ", data=" + data +
                ", status=" + status +
                ", gather_date=" + gather_date +
                '}';
    }
}
